﻿#if UNITY
using System;

namespace com.susi.util
{
    public class LifeReturner : UnityEngine.MonoBehaviour
    {
        public event Action onUpdate;
        public event Action onFixedUpdate;
        public event Action onLateUpdate;
        public event Action onEnable;
        public event Action onDisable;
        public event Action onDestroy;

        private void Update()
        {
            if (onUpdate != null) onUpdate();
        }
        private void FixedUpdate()
        {
            if (onFixedUpdate != null) onFixedUpdate();
        }
        private void LateUpdate()
        {
            if (onLateUpdate != null) onLateUpdate();
        }
        //private void Awake()
        //{
        //}
        //private void Start()
        //{
        //}
        private void OnEnable()
        {
            if (onEnable != null) onEnable();
        }
        private void OnDisable()
        {
            if (onDisable != null) onDisable();
        }
        private void OnDestroy()
        {
            if (onDestroy != null) onDestroy();
        }
    }
}
#endif